﻿using eProcurement.DAL;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

namespace eProcurement.controls
{
    public partial class MyBidsItemControl : System.Web.UI.UserControl
    {
        protected void Page_Load( object sender, EventArgs e )
        {

        }

        public void Setup( Bid bid )
        {
            lblClosureDate.InnerText = bid.Project.CloseDate.ToShortDateString();
            lblCompany.InnerText = bid.Project.Purchaser.CompanyName;
            lblCompany.Attributes.Add( "href", "../members/Company.aspx?pid=" + bid.ProjectId );
            lblDescription.InnerText = bid.Project.Title;
            lblProject.InnerText = bid.Project.Description;
            lblProjectStatus.InnerText = bid.Project.State;
            if ( bid.Project.State == ProjectState.OPEN.ToString() )
            {
                lnkResubmit.Attributes.Add( "href", "../members/PlaceBid.aspx?pid=" + bid.ProjectId );
                lnkDelete.Attributes.Add( "href", "../members/MyBids.aspx?dbid=" + bid.Id );
            }
            else
            {
                lnkResubmit.Visible = false;
                lnkDelete.Visible = false;
            }
        }
    }
}